<!DOCTYPE html>
<html lang="zh-cmn-Hans">
<head>
	<meta charset="UTF-8">
	<link rel="shortcut icon" href="/index/favicon.ico">
	<link rel="stylesheet" href="/index/css/iconfont.css">
	<link rel="stylesheet" href="/index/css/global.css">
	<link rel="stylesheet" href="/index/css/bootstrap.min.css">
	<link rel="stylesheet" href="/index/css/bootstrap-theme.min.css">
	<link rel="stylesheet" href="/index/css/login.css">
	<script src="/index/js/jquery.1.12.4.min.js" charset="UTF-8"></script>
	<!-- <script src="/jquery-3.2.1.min.js"></script> -->
	<script src="/index/js/bootstrap.min.js" charset="UTF-8"></script>
	<script src="/index/js/jquery.form.js" charset="UTF-8"></script>
	<script src="/index/js/global.js" charset="UTF-8"></script>
	<title>U袋网 - 登录 / 注册</title>
</head>
<style type="text/css">
	#passwordSpan{
		font-size: 12px;
	}
	#confirmpasswordSpan{
		font-size: 12px;
	}
	#phoneSpan{
		font-size: 12px;
	}
	#captchaSpan{
		font-size: 12px;
	}
	.errorColor{
		color: red;
	}
	.okColor{
		color: green;
	}
	.sucess{
		color: #ccc;
	}
	.p1{
		margin-left: 150px;
	}
	.form-group{
		margin-bottom: 0;
		height:56px;
	}
</style>
<script>
	var checkpassword=false;
	var checkpass=false;
	var checkphone=false;
	function check(){
		if(checkphone&&checkpassword&&checkpass){
			return true;
		}else{
			return false;
		}
	}
	window.onload=function(){
		//手机号码校验
	    var phone=document.getElementById("phone");
		var phoneSpan=document.getElementById("phoneSpan");
		// var phoneSp=document.getElementById("phoneSp");
		phone.onfocus=function(){
			phoneSpan.innerHTML="手机号码必须由11位数字组成";
            phoneSpan.className="sucess";
            // phoneSp.innerHTML="手机号码必须由11位数字组成";
            // phoneSp.className="sucess";
		}
		phone.onblur=function(){
           if(phone.value==""){
               phoneSpan.innerHTML="❌手机号码不能为空";
               phoneSpan.className="errorColor";
               // phoneSp.innerHTML="❌手机号码不能为空";
               // phoneSp.className="errorColor";
               checkphone=false;
			}else{
				var phone_reg=/^(13|14|15|17|18)\d{9}$/;
               if(phone_reg.test(phone.value)){
                    // phoneSpan.innerHTML="手机号码格式正确";
                    // phoneSpan.className="okColor";
                    checkphone=true;
                    $(function(){
                    	var phone = $("#phone").val()
	                    // alert(phone);
						$.ajax({
							url:"/index/vip/yanzheng",  //请求地址
							type:"post",  //发送方式
							data:{"phone":phone},  //是否同步
							dataType:"json",  //响应数据格式
							success:function(data){
								if(data == 1){
									$('#phoneSpan').html('✔该手机号可用');
									phoneSpan.className="okColor";
								}else{
									$('#phoneSpan').html('❌已经被注册');
									phoneSpan.className="errorColor";
								}
							}
						});
                    })

               }else{
                   phoneSpan.innerHTML="❌手机号码格式不正确";
                   phoneSpan.className="errorColor";
                   // phoneSp.innerHTML="❌手机号码格式不正确";
                   // phoneSp.className="errorColor";
                   checkphone=false;
               }
			}
		}
		//密码校验
		var password=document.getElementById("password");
		var passwordSpan=document.getElementById("passwordSpan")
		password.onfocus=function(){
			 passwordSpan.innerHTML="密码必须是6位数字组成";
             passwordSpan.className="sucess";
		}
		password.onblur=function(){
           if(password.value==""){
                 passwordSpan.innerHTML="❌密码不能为空";
                 passwordSpan.className="errorColor";
                 checkpassword=false;
			}else{
				var pwd_reg=/^\d{6}$/;
               if(pwd_reg.test(password.value)){
                     passwordSpan.innerHTML="✔格式正确";
                     passwordSpan.className="okColor";
                     checkpassword=true;
               }else{
                    passwordSpan.innerHTML="密码必须是6位数字组成";
                    passwordSpan.className="errorColor";
                    checkpassword=false;
               }
			}
		}


		//再次密码校验
		var pass=document.getElementById("pass");
		var confirmpasswordSpan=document.getElementById("confirmpasswordSpan");
		pass.onfocus=function(){
			 confirmpasswordSpan.innerHTML="请再次输入密码";
             confirmpasswordSpan.className="sucess";
		}
		pass.onblur=function(){
           if(password.value==pass.value){
                 confirmpasswordSpan.innerHTML="✔格式正确";
                 confirmpasswordSpan.className="okColor";
                 checkconfirmpassword=true;
			}else{
				 confirmpasswordSpan.innerHTML="❌两次输入密码不一致";
                 confirmpasswordSpan.className="errorColor";
                checkconfirmpassword=false;
			}

		}


		//密码校验
		var password2=document.getElementById("password2");
		var passwordSpan2=document.getElementById("passwordSpan2");
		password2.onblur=function(){
           if(password2.value==""){
                 passwordSpan2.innerHTML="❌密码不能为空";
                 passwordSpan2.className="errorColor";
                 checkpassword=false;
			}else{
				var pwd_reg=/^\d{6}$/;
               if(pwd_reg.test(password2.value)){
                     passwordSpan2.innerHTML="✔格式正确";
                     passwordSpan2.className="okColor";
                     checkpassword=true;
               }else{
                    passwordSpan2.innerHTML="密码必须是6位数字组成";
                    passwordSpan2.className="errorColor";
                    checkpassword=false;
               }
			}
		}


		//再次密码校验
		var pass2=document.getElementById("pass2");
		var confirmpasswordSpan2=document.getElementById("confirmpasswordSpan2");
		pass2.onfocus=function(){
			 confirmpasswordSpan2.innerHTML="请再次输入密码";
             confirmpasswordSpan2.className="sucess";
		}
		pass2.onblur=function(){
           if(password2.value==pass2.value){
                 confirmpasswordSpan2.innerHTML="✔格式正确";
                 confirmpasswordSpan2.className="okColor";
                 checkconfirmpassword=true;
			}else{
				 confirmpasswordSpan2.innerHTML="❌两次输入密码不一致";
                 confirmpasswordSpan2.className="errorColor";
                checkconfirmpassword=false;
			}

		}

	}
</script>
<body>
	<div class="public-head-layout container">
		<a class="logo" href="/"><img src="/index/images/icons/logo.jpg" alt="U袋网" class="cover"></a>
	</div>
	<div style="background:url(/index/images/login_bg.jpg) no-repeat center center; ">
		<div class="login-layout container">
			<div class="form-box login">
				<div class="tabs-nav">
					<h2>欢迎登录U袋网平台</h2>
				</div>
				<div class="tabs_container">
					<form onsubmit="return false">
						<div class="form-group">
							<div class="input-group">
								<div class="input-group-addon">
									<span class="glyphicon glyphicon-phone" aria-hidden="true"></span>
								</div>
								<input class="form-control phone" name="phone" id="phone1" required placeholder="手机号" maxlength="11" autocomplete="off" type="text">
							</div>
							<span id="phoneSpan2"></span>
						</div>
						<div class="form-group">
							<div class="input-group">
								<div class="input-group-addon">
									<span class="glyphicon glyphicon-lock" aria-hidden="true"></span>
								</div>
								<input class="form-control password" name="password" id="password1" placeholder="请输入密码" autocomplete="off" type="password">
							</div>
							<span id="phoneSpan3"></span>
						</div>
						<div class="userAccountLogin-errorTipsDiv" id="phoneSp"></div>
						<div class="checkbox">
	                        <label>
	                        	<input checked="" id="login_checkbox" type="checkbox"><i></i> 30天内免登录
	                        </label>
	                        <a href="javascript:;" class="pull-right" id="resetpwd">忘记密码？</a>
	                    </div>
	                    <button class="btn btn-large btn-primary btn-lg btn-block submit" id="btnLogin" type="button">登录</button><br>
	                    <p class="text-center">没有账号？<a href="javascript:;" id="register">免费注册</a></p>
                    </form>
                    <div class="tabs_div">
	                    <div class="success-box">
	                    	<div class="success-msg">
								<i class="success-icon"></i>
	                    		<p class="success-text">登录成功</p>
	                    	</div>
	                    </div>
	                    <div class="option-box">
	                    	<div class="buts-title">
	                    		现在您可以
	                    	</div>
	                    	<div class="buts-box">
	                    		<a role="button" href="/" class="btn btn-block btn-lg btn-default">继续访问商城</a>
								<a role="button" href="/index/udai/udai_welcome" class="btn btn-block btn-lg btn-info">登录会员中心</a>
	                    	</div>
	                    </div>
                    </div>
                </div>
			</div>
			<div class="form-box register">
  				<div class="tabs-nav">
  					<h2>欢迎注册<a href="javascript:;" class="pull-right fz16" id="reglogin">返回登录</a></h2>
  				</div>
  				<div class="tabs_container">
					<form onsubmit="return check()">
						<div class="form-group">
							<div class="input-group">
								<div class="input-group-addon">
									<span class="glyphicon glyphicon-phone" aria-hidden="true"></span>
								</div>
								<input class="form-control phone" name="phone" id="phone" required placeholder="手机号" maxlength="11" autocomplete="off" type="text" value="{{old('phone')}}">
							</div>
							<span id="phoneSpan"></span>
						</div>
						<div class="form-group" >
							<div class="input-group">
								<input class="form-control" name="captcha" id="captcha" placeholder="输入验证码" type="text">
								<span class="input-group-btn">
									<input onclick="" type="button"  class="btn btn-primary getsms" autocomplete="off" id="btn"  value="获取验证码">
								</span>
							</div>
							<span id="captchaSpan"></span>
						</div>
						<div class="form-group" >
							<div class="input-group">
								<div class="input-group-addon">
									<span class="glyphicon glyphicon-lock" aria-hidden="true"></span>
								</div>
								<input class="form-control password" name="password" id="password" placeholder="请输入密码" autocomplete="off" type="password">
							</div>
							<span id="passwordSpan"></span>
						</div>
						<div class="form-group" >
							<div class="input-group">
								<div class="input-group-addon">
									<span class="glyphicon glyphicon-lock" aria-hidden="true"></span>
								</div>
								<input class="form-control password" name="pass" id="pass" placeholder="请确认密码" autocomplete="off" type="password">
							</div>
							<span id="confirmpasswordSpan"></span>
						</div>
						<div class="checkbox">
	                        <label>
	                        	<input checked="" id="register_checkbox" type="checkbox"><i></i> 同意<a href="/index/temp_article/udai_article3.html">U袋网用户协议</a>
	                        </label>
	                    </div>
	                    <!-- 错误信息 -->
						<!-- <div class="form-group">
							<div class="error_msg" id="register_error"></div>
						</div> -->
	                    <button class="btn btn-large btn-primary btn-lg btn-block submit" id="btnSubmit" type="button">注册</button>
                    </form>
                </div>
			</div>
			<div class="form-box resetpwd">
  				<div class="tabs-nav clearfix">
  					<h2>找回密码<a href="javascript:;" class="pull-right fz16" id="pwdlogin">返回登录</a></h2>
  				</div>
  				<div class="tabs_container">
					<form onsubmit="return check()">
						<div class="form-group">
							<div class="input-group">
								<div class="input-group-addon">
									<span class="glyphicon glyphicon-phone" aria-hidden="true"></span>
								</div>
								<input class="form-control phone" name="phone" id="phone2" required placeholder="手机号" maxlength="11" autocomplete="off" type="text">
							</div>
						</div>
						<div class="form-group">
							<div class="input-group">
								<input class="form-control" name="sms" id="captcha2" placeholder="输入验证码" type="text">
								<span class="input-group-btn">
									<input onclick="" type="button"  class="btn btn-primary getsms" autocomplete="off" id="btn2"  value="获取验证码">
								</span>
							</div>
							<span style="margin: 40px;" class="vam" id="msg_authCode"></span>
						</div>
						<div class="form-group">
							<div class="input-group">
								<div class="input-group-addon">
									<span class="glyphicon glyphicon-lock" aria-hidden="true"></span>
								</div>
								<input class="form-control password" name="password" id="password2" placeholder="新的密码" autocomplete="off" type="password">
							</div>
							<span id="passwordSpan2"></span>
						</div>
						<div class="form-group">
							<div class="input-group">
								<div class="input-group-addon">
									<span class="glyphicon glyphicon-lock" aria-hidden="true"></span>
								</div>
								<input class="form-control password" name="password" id="pass2" placeholder="确认新的密码" autocomplete="off" type="password">
							</div>
							<span id="confirmpasswordSpan2"></span>
						</div>
	                    <button class="btn btn-large btn-primary btn-lg btn-block submit" id="submit" type="button">重置密码</button>
                    </form>
                    <div class="tabs_div">
	                    <div class="success-box">
	                    	<div class="success-msg">
								<i class="success-icon"></i>
	                    		<p class="success-text">密码重置成功</p>
	                    	</div>
	                    </div>
	                    <div class="option-box">
	                    	<div class="buts-title">
	                    		现在您可以
	                    	</div>
	                    	<div class="buts-box">
	                    		<a role="button" href="/" class="btn btn-block btn-lg btn-default">继续访问商城</a>
								<a role="button" href="/index/login" class="btn btn-block btn-lg btn-info">返回登陆</a>
	                    	</div>
	                    </div>
                    </div>
                </div>
			</div>
			<script>
				$(function(){
					//=========================找回密码=======================
					$("#btn2").click(function(){
						//验证码获取
						var captcha='';
						var phone = $("#phone2").val();
						$.ajax({
							url:"/index/vip/message",        //请求地址
							type:"post",     //发送方式
							data:{"phone":phone},      //是否同步
							// dataType:"json",    //响应数据格式
							success:function(data){
								// alert(data);
							}
						});

						var time = 30;
						if($('#btn2').val()=='获取验证码'){
							// alert(1);
							var cctime=setInterval(function(){
								time--;
								$('#btn2').val('重新发送'+time+'s');
								if (time == 0){
									clearInterval(cctime);
									$('#btn2').val('获取验证码');
								}
							},1000);
						}
					})
					$("#submit").click(function(){
						var captcha = $("#captcha2").val();
						var password = $("#password2").val();
						// var pass = $("#pass2").val();
						// alert(111);
						$.ajax({
							url:"/index/vip/zhpassword",  // 请求url地址
							type:"post", // 传值方式
							data:{
								"captcha":captcha,
								"password":password,
								// "pass":pass
							},  // 传输数据
							// dataType:"json",    //响应数据格式
							success:function(data){
								// alert(data);
								if (data == 0) {
									$("#msg_authCode").html("验证码有误").css('color','red');
								}else if (data == 1) {
									window.location.href="/index/vip/login";
								}

							}
						})
					})


					//=====================执行登录=====================
					$("#btnLogin").click(function(){
						var phone = $("#phone1").val();
						var password = $("#password1").val();
						// alert(password);

							$.ajax({
							url:"/index/vip/login2",  // 请求url地址
							type:"post", // 传值方式
							data:{
								"phone":phone,
								"password":password,
							},  // 传输数据
							dataType : 'json',//响应数据格式

							success:function(data){
								// console.log(data);
								// alert(data);
								if (data == 1) {
									$("#phoneSpan3").html("❌密码错误").css("color","red");
								}else if(data == 0){
									$("#phoneSpan2").html("❌用户不存在").css("color","red");
								}else if (data == 2) {
									window.location.href = "/";
								}else if (data == 3) {
									$("#phoneSpan2").html("❌该账号已被禁止登陆").css("color","red");
								}
							}
						})
					})



					// 判断直接进入哪个页面 例如 login.php?p=register
					switch($.getUrlParam('p')) {
						case 'register': $('.register').show(); break;
						case 'resetpwd': $('.resetpwd').show(); break;
						default: $('.login').show();
					};
					//====================执行注册======================
					$("#btn").click(function(){
						//验证码获取
						var captcha='';
						var phone = $("#phone").val();
						$.ajax({
							url:"/index/vip/message",        //请求地址
							type:"post",     //发送方式
							data:{"phone":phone},      //是否同步
							// dataType:"json",    //响应数据格式
							success:function(data){
								// alert(data);
							}
						});

						var time = 30;
						if($('#btn').val()=='获取验证码'){
							// alert(1);
							var cctime=setInterval(function(){
								time--;
								$('#btn').val('重新发送'+time+'s');
								if (time == 0){
									clearInterval(cctime);
									$('#btn').val('获取验证码');
								}
							},1000);
						}
					})

					$("#btnSubmit").click(function(){
						// alert('1');
						var captcha = $("#captcha").val();
						var phone = $("#phone").val();
						// alert(phone);
						var password = $("#password").val();
						var pass = $("#pass").val();
						$.ajax({
							url:"/index/vip/add",  // 请求url地址
							type:"post", // 传值方式
							data:{
								"phone":phone,
								"captcha":captcha,
								"password":password
							},  // 传输数据
							success:function(data){
								// alert(data);
								if (data == 0) {
									$("#captchaSpan").html("❌验证码有误").css('color','red');
								}else if(data == 1){
									$("#phoneSpan").html("❌手机号有误").css('color','red');
								}else if (data == 2) {
									$("#captchaSpan").html("✔验证成功").css('color','green');
								}else if (data == 3) {
									$('#phoneSpan').html('❌已经被注册').css('color','red');
								}else if(data == 4) {
									// alert(111);
									window.location.href="/index/vip/login";
								}
							}
						})
					})
				})

				$('#register').click(function() {$('.login').fadeOut(150,function() {$('.register').fadeIn(150)})});
				$('#resetpwd').click(function() {$('.login').fadeOut(150,function() {$('.resetpwd').fadeIn(150)})});
				$('#reglogin').click(function() {$('.register').fadeOut(150,function() {$('.login').fadeIn(150)})});
				$('#pwdlogin').click(function() {$('.resetpwd').fadeOut(150,function() {$('.login').fadeIn(150)})});
			</script>
		</div>
	</div>
	<div class="footer-login container clearfix">
		<ul class="links">
			<a href="javascript:;"><li>网店代销</li></a>
			<a href="javascript:;"><li>U袋学堂</li></a>
			<a href="javascript:;"><li>联系我们</li></a>
			<a href="javascript:;"><li>企业简介</li></a>
			<a href="javascript:;"><li>新手上路</li></a>
		</ul>
		<!-- 版权 -->
		<p class="copyright">
			© 2005-2017 U袋网 版权所有，并保留所有权利<br>
			ICP备案证书号：闽ICP备16015525号-2&nbsp;&nbsp;&nbsp;&nbsp;福建省宁德市福鼎市南下村小区（锦昌阁）1栋1梯602室&nbsp;&nbsp;&nbsp;&nbsp;Tel: 18650406668&nbsp;&nbsp;&nbsp;&nbsp;E-mail: 18650406668@qq.com
		</p>
	</div>
</body>
</html>